import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 配音信息 */
export interface VoiceActors {
          id: number; // 配音作品唯一ID
          userId: number; // 用户ID
          bookId: number; // 绘本ID
          audioUrl: string; // 音频URL
          score: number; // 配音评分
          creator: string; // 创建者
          createTime: string | Dayjs; // 创建时间
          updater: string; // 更新者
          updateTime: string | Dayjs; // 更新时间
          deleted: boolean; // 是否删除
  }

// 配音 API
export const VoiceActorsApi = {
  // 查询配音分页
  getVoiceActorsPage: async (params: any) => {
    return await request.get({ url: `/pickbook/voice-actors/page`, params })
  },

  // 查询配音详情
  getVoiceActors: async (id: number) => {
    return await request.get({ url: `/pickbook/voice-actors/get?id=` + id })
  },

  // 新增配音
  createVoiceActors: async (data: VoiceActors) => {
    return await request.post({ url: `/pickbook/voice-actors/create`, data })
  },

  // 修改配音
  updateVoiceActors: async (data: VoiceActors) => {
    return await request.put({ url: `/pickbook/voice-actors/update`, data })
  },

  // 删除配音
  deleteVoiceActors: async (id: number) => {
    return await request.delete({ url: `/pickbook/voice-actors/delete?id=` + id })
  },

  /** 批量删除配音 */
  deleteVoiceActorsList: async (ids: number[]) => {
    return await request.delete({ url: `/pickbook/voice-actors/delete-list?ids=${ids.join(',')}` })
  },

  // 导出配音 Excel
  exportVoiceActors: async (params) => {
    return await request.download({ url: `/pickbook/voice-actors/export-excel`, params })
  }
}